package uitest 
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.utils.setTimeout;
	import iscript.uiFramework.components.form.Checkbox;
	import iscript.uiFramework.components.form.ComboBox;
	import iscript.uiFramework.components.form.ListBox;
	import iscript.uiFramework.components.form.Radio;
	import iscript.uiFramework.components.form.TextInput;
	import iscript.uiFramework.data.ComboBoxModel;
	import iscript.uiFramework.data.ListBoxModel;
	import iscript.uiFramework.event.ComboBoxEvent;
	public class FormUITest extends Sprite
	{
		[Embed(source="../../bin/icon/music.png")]
		private var music:Class;
		
		public function FormUITest() 
		{
				var textInput:TextInput = new TextInput();
			textInput.x = 300;
			textInput.y = 100;
			textInput.width = 200;
			//textInput.editable = false;
			//	 textInput.height = 22;
			// trace(textInput.width,textInput.height)
			// textInput.border = true;
			textInput.render(this);
			
			
			var cbbData:Vector.<ComboBoxModel> = new Vector.<ComboBoxModel>();
			for (var i:int = 0; i < 14; i++) 
			{
			     var cbbd:ComboBoxModel = new ComboBoxModel();
				     cbbd.text = "Cell-" + i;
					 cbbd.value = i;
					 // cbbd.bitmap = null;
					cbbd.bitmap = Bitmap(new music()).bitmapData;
					 cbbData.push(cbbd);
			}
			
			var combobox:ComboBox = new ComboBox();
			combobox.storeData = cbbData;
			combobox.x = 300;
			combobox.y = 160;
		//	combobox.width = 150;
			combobox.addEventListener(ComboBoxEvent.CellRender_Select,cellSelect)
			combobox.render(this);
			
			var checkboxNames:Array = ["name","sex","age"]
			for (var j:int = 0; j < 3; j++) 
			{				
				var checkbox:Checkbox = new Checkbox();
				checkbox.text =String(checkboxNames[j])
				checkbox.x = 300
				checkbox.y = 200 + j * checkbox.height +5;
				checkbox.render(this);	
			}
			
	 
			for (var k:int = 0; k < 3; k++) 
			{				
				var radio:Radio = new Radio();
				radio.text =String(checkboxNames[k])
				radio.x = 400
				radio.y = 200 + k* radio.height +5;
				radio.render(this);	
			}
			
			
			var listdata:Vector.<ListBoxModel> = new Vector.<ListBoxModel>();
			for (var i:int = 0; i < 14; i++) 
			{
			     var ld:ListBoxModel = new ListBoxModel();
				     ld.text = "Cell-" + i;
					 ld.value = i;
					 ld.bitmap = Bitmap(new music()).bitmapData;
					 listdata.push(ld);
			}
			
			var listbox:ListBox = new ListBox();
			listbox.storeData = listdata;
			listbox.x = 500;
			listbox.y = 160;
			listbox.border = true;
			listbox.render(this)
			
			
			
		}
		
				
		private function cellSelect(e:ComboBoxEvent):void 
		{
			trace(e.selectData.value);
		}
		
	}

}